#include "User.h"

Player::Player()
{
	mName = NULL;
	memset(TopScore,0,10);
};

//TODO: Exlpicitly call a destructor
void Player::SetName(const char *name)
{
	size_t length = strlen(name);

	if( mName != NULL 
		&& length !=strlen(mName))
	{
		delete [] mName;
		mName = NULL;
	}

	if(mName == NULL)
	{
		mName = new char[length + 1];
	}

	strcpy(mName,name);
}

const char* Player::GetName()
{
	return mName;
}

